package com.company.test27_28;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.Stack;

/**
 * Created by Administrator on 2016.11.8.
 */
public class NineTailModel {
    final static int MAX=512;
    final static boolean[][] vertices=new boolean[MAX][9];
    final static List<AbstractGraph.Edge> edges=new ArrayList<>();
    final static int[][] change={
            {0,1,3},{0,1,2,4},{1,2,5},{0,3,4,6},{1,3,4,5,7},
            {2,4,5,8},{3,6,7},{4,6,7,8},{5,7,8}
    };

    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        initialize();
        Graph<boolean[]> graph=new UnweightedGraph<boolean[]>(edges,vertices);
        String str=input.next();
        boolean[] in=new boolean[9];
        for(int i=0;i<str.length();i++){
            if(str.charAt(i)=='H')
                in[i]=true;
        }
        int sign=conversion(in);
        Graph.SpanningTree bfs=graph.bfs(sign);
        Stack<Integer> stack=new Stack<>();
        stack.push(0);
        int current=bfs.getParent(0);
        while (current!=sign){
            stack.push(current);
            current=bfs.getParent(current);
        }
        stack.push(sign);
        while (!stack.isEmpty()){
            boolean[] out=vertices[stack.pop()];
            for(int i=0;i<out.length;i++){
                if(out[i]){
                    System.out.print("H");
                }else {
                    System.out.print("T");
                }
                if(i%3==2){
                    System.out.println();
                }
            }
            System.out.println();
        }
    }

    public static void initialize(){
        for(int i=0;i<MAX;i++){
            int temp=i;
            for(int j=0;j<9;j++){
                if(temp%2==1){
                    vertices[i][j]=true;
                }
                temp=temp/2;
            }
        }

        for(int i=0;i<MAX;i++){
            for(int j=0;j<9;j++){
                boolean[] v;
                v=vertices[i].clone();
                for(int k=0;k<change[j].length;k++){
                    v[change[j][k]]=!v[change[j][k]];
                }
                int point=conversion(v);
                edges.add(new AbstractGraph.Edge(i,point));
            }
        }
    }

    public static int conversion(boolean[] v){
        int sum=0;
        int temp=1;
        for(int i=0;i<v.length;i++){
            if(v[i])
                sum+=temp;
            temp=temp*2;
        }
        return sum;
    }
}